#include<stdio.h>
#include<unistd.h>
#include <sys/types.h>
int main()
{
  pid_t id = fork();              
  if (id == 0)
  {
    while(1)
    {
      printf("child, pid->%d, ppid->%d\n", getpid(), getppid());
       sleep(1); 
    }
  }
  else if(id > 0)
  {
    while(1)
    {
      printf("father, pid->%d, ppid->%d\n", getpid(), getppid());
      sleep(1);
    }
  }
  else{
    printf("创建失败\n");
  }
 // while(1)
 // {
 //   printf("i am a process,my id is %d,my father's id is %d\n", getpid(), getppid());
 //   sleep(1);
 // }
  return 0;
}

